package com.wanghao.ui;

import java.util.ArrayList;
import java.util.List;

import org.w3c.dom.Element;

import com.wanghao.proxy.UICreateFromXml;
import com.wanghao.proxy.VarManAdapter;
import com.wanghao.utils.ChainParam;

public class UI implements UICreateFromXml {
	private Query query;

	public UI(VarManAdapter aVarManAdapter) {
		super();
		query = new Query(aVarManAdapter);
	}

	public Query getQuery() {
		return query;
	}

	public void setQuery(Query aQuery) {
		this.query = aQuery;
	}

	public void AddControl(UIControl aControl) {
		query.AddControl(aControl);
	}

	@Override
	public List<ChainParam> StartCreate(Element aElement) throws Exception {
		ArrayList<ChainParam> list = new ArrayList<ChainParam>();

		ChainParam queryParam = new ChainParam(query, aElement);
		list.add(queryParam);
		return list;
	}
}
